package soen343.data;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.dsrg.ts.threadLocal.DbRegistry;

public class QuizTDG {
	private QuizTDG() { }
	
	public static ResultSet findById(int id) throws SQLException{
		String SQLString = "SELECT * FROM quiz WHERE id = ?";
		PreparedStatement ps = DbRegistry.getDbConnection().prepareStatement(SQLString);
		ps.setInt(1, id);
		return ps.executeQuery();
	}
	
	public static ResultSet findByName(String name) throws SQLException {
		String SQLString = "SELECT * FROM quiz WHERE name = ?";
		PreparedStatement ps = DbRegistry.getDbConnection().prepareStatement(SQLString);
		ps.setString(1, name);
		return ps.executeQuery();
	}
}
